package main

import (
	"flag"
	"github.com/scott-go/protoc-gen-code-generator/gen"
	"google.golang.org/protobuf/compiler/protogen"
	"google.golang.org/protobuf/types/pluginpb"
)

const version = "0.0.1"

var genType = "gin"

func main() {
	//showVersion := flag.Bool("version", false, "print the version and exit")
	//flag.Parse()
	//if *showVersion {
	//	fmt.Printf("protoc-gen-go-kit %v\n", version)
	//	return
	//}

	var flags flag.FlagSet
	options := protogen.Options{
		ParamFunc: flags.Set,
	}
	options.Run(func(plugin *protogen.Plugin) error {
		plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
		for _, f := range plugin.Files {
			if !f.Generate {
				continue
			}
			gen.GenerateFile(genType, plugin, f)
		}
		return nil
	})
}
